package com.ruoyi.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.dto.PartitionAddDTO;
import com.ruoyi.dto.PartitionDTO;
import com.ruoyi.service.PartitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

import static com.ruoyi.common.utils.PageUtils.startPage;

/**
 * 分区表
 * @Author:zzm
 * @Date: 2024/8/30 11:08
 */
@RestController
@RequestMapping("/amac/partition")
public class PartitionController extends BaseController {

    @Autowired
    private PartitionService partitionService;

    /**
     * 查询
     * @param dto
     * @return
     */
    @GetMapping("/getList")
    public TableDataInfo getList(PartitionDTO dto){
        startPage();
        return getDataTable(partitionService.getList(dto));
    }

    @PostMapping("/add")
    public AjaxResult add(@RequestBody @Valid PartitionAddDTO dto){
        return AjaxResult.success(partitionService.add(dto));
    }
}
